package org.zjt.book

/**
  * Trait： 接口和方法实现
  */
trait TestTrait {
  var name : String

  def desc

  def show = { println( "  show  "+ name) }

}


/**
  *  AccountTrait 将 name传递给接口类
  * @param name
  */
class AccountTrait(override var name: String ) extends TestTrait {

  override def desc: Unit = {
    println("name = "+this.name)
  }

}

object TraitStart extends App{

  var account = new AccountTrait("zhang")
  account.desc
  account.show

}
